package com.atguigu.flink.streamx;

import com.streamxhub.streamx.flink.core.StreamEnvConfig;
import com.streamxhub.streamx.flink.core.java.source.KafkaSource;
import com.streamxhub.streamx.flink.core.scala.StreamingContext;
import org.apache.flink.streaming.api.scala.StreamExecutionEnvironment;

/**
 * TODO
 *
 * @author cjp
 * @version 1.0
 */
public class StreamxKafkaDemo {
    public static void main(String[] args) {
        // Flink API写法
//        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
//        env.set

        // StreamX API写法
        StreamEnvConfig envConfig = new StreamEnvConfig(args, null);
        StreamingContext context = new StreamingContext(envConfig);

        new KafkaSource<String>(context)
                .topic("s1")
                .getDataStream()
                .map(record -> record.value())
                .print("s1");

        new KafkaSource<String>(context)
                .topic("s2")
                .getDataStream()
                .map(record -> record.value())
                .print("s2");

        context.start();


    }
}
